<template>
  <div>
    <Input v-model="token" size="large" clearable placeholder="please input access token" />
    <br><br>
    <Button ghost style="width: 80px;" size="large" @click="setToken">Set</Button>
    <Button ghost style="width: 80px; float: right;" size="large" @click="resetToken">Reset</Button>
  </div>
</template>

<script>
export default {
  name: "access",

  data() {
    return {
      token: ''
    };
  },

  methods: {
    setToken() {
      this.$store.commit('setToken', this.token)
      this.$Notice.success({
        title: "设置成功!",
        desc: '令牌十五分钟内有效，请把握好时间!',
        duration: 5
      })
      setTimeout(() => {
        this.resetToken()
      }, 1000 * 60 * 15)
    },

    resetToken() {
      this.$store.commit('setToken')
      this.$Notice.success({
        title: "重置成功!",
        duration: 5
      })
    }
  }
};
</script>

<style scoped>
</style>